Image compositing device based on mask image, image compositing method based on mask image, and non-transitory computer-readable recording medium therefor

ABSTRACT

A storage (240) of an image processing device (100) stores a background image (2410) and a first image (2420) and a second image (2430) that are foreground images with respect to the background image (2410), and a first basic mask image (the first basic mask image (2450) formed from pixels having a pixel value of ‘1’ indicating opacity and pixels having a pixel value of ‘0’ indicating transparence. An acquirer (250) acquires each of these images. An image generator (220) generates a first intermediate image by compositing the first image (2420) onto the background image (2410) only in pixels that are in the same positions as the pixels in the first basic mask image (2450) having the pixel value of ‘1’. The image generator (220) then generates a first composite image by overwriting the second image (2430) onto the first intermediate image only in the pixels that are in the same positions as the pixels in the first basic mask image (2450) having the pixel value of ‘1’.

PRIORITY CLAIM

This is a U.S. national stage of application No. PCT/JP2014/078506,filed on Oct. 27, 2014. Priority is claimed on the followingapplications: Country: Japan, Application No.: 2014-055087, Filed: Mar.18, 2014), the content of which is incorporated here by reference

TECHNICAL FIELD

The present disclosure relates to an image processing device, an imageprocessing method, and a program.

BACKGROUND ART

Alpha blending processing whereby two images are composited togetherbased on opacity degree of each of the pixels in each of the images is aknown image processing technique (Refer to Patent Literature 1.). Byusing alpha blending processing to composite the foreground image onto abackground image, an image can be created that makes the foregroundimage semi-transparent with respect to the background image.

When, for example, an image of an anime character (two-dimensionalmodel) is a foreground image, alpha blending processing is used forfading in the character. When the character image is madesemi-transparent with respect to a background image, the character imageis composited onto the background image based on the opacity degree ofthe entire image of the character with respect to the background image.

When the character is wearing clothing, the character image is often animage in which an image of clothing is composited with an image of abody. Here, to display the semi-transparent image of the character, theimage of the body is made semi-transparent and is composited onto thebackground image by using the alpha blending processing. Next, the imageof the clothing in the foreground of image of the body is madesemi-transparent and is composited. In such a case however, asemi-transparent image is generated in which the body that should behidden shows through the clothing instead.

To prevent the body from showing through, first, the image of the bodyis overwritten with the image of the clothing and a semi-transparentcharacter image is generated. Next, the generated character image iscomposited onto the background image through alpha blending processing.

CITATION LIST Patent Literature

-   Patent Literature 1: Unexamined Japanese Patent Application Kokai    Publication No. 2005-122479

SUMMARY OF INVENTION Technical Problem

However, in the above-described method for preventing the body fromshowing through, after the composite image of the clothing image and thebody image is generated, the composite image must then be compositedonto the background image. Therefore, the processing load caused bycomposition processing is high. Likewise, the storage capacity requiredfor storing composite images also increases. Besides clothing and bodyimages, the same problem also occurs when a semi-transparent imagecontaining a deeply positioned first image and a second image positionedin front of the first image that are in a same location, is compositedonto a background image.

The present disclosure is made to solve the problems described above,and an objective of the present disclosure is to provide an imageprocessing device, an image processing method, and a program that enableeasy generation of an image in which a first image and a second imageare semi-transparent with respect to a background image without thefirst image showing through the second image.

Solution to Problem

To achieve the above-mentioned objective, the image processing deviceincludes:

storage means for storing a background image, a first image and a secondimage that are foreground images with respect to the background imageand have predetermined positions relative to the background image, and afirst mask image formed from pixels having a first pixel valueindicating opacity and pixels having a zero pixel value indicatingtransparence;

acquisition means for acquiring the background image, the first image,the second image, and the first mask image from the storage means; and

image generation means for generating a first composite image in whichthe second image acquired by the acquisition means is composited, ontothe background image acquired by the acquisition means, in the pixelsthat are in the same positions as the pixels in the first mask imagehaving the first pixel value, and the first image acquired by theacquisition means is composited, onto the background image acquired bythe acquisition means, where the second image is not composited, in thepixels that are in the same positions as the pixels in the first maskimage having the first pixel value.

Advantageous Effects of Invention

According to the present disclosure, an image may be generated in whicha first image and a second image are semi-transparent with respect to abackground image without the first image showing through the secondimage.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a hardware configuration of animage processing device according to an embodiment of the presentdisclosure;

FIG. 2 is a function block diagram of the image processing deviceaccording to the embodiment of the present disclosure;

FIG. 3A is a diagram illustrating a background image according to theembodiment of the present disclosure;

FIG. 3B is a diagram illustrating a first image according to theembodiment of the present disclosure;

FIG. 3C is a diagram illustrating a second image according to theembodiment of the present disclosure;

FIG. 3D is a diagram illustrating a third image according to theembodiment of the present disclosure;

FIG. 3E is a diagram illustrating a fourth image according to theembodiment of the present disclosure;

FIG. 4 is a diagram illustrating a relative positional relationshipbetween the background image and the first image according to theembodiment of the present disclosure;

FIG. 5 is a diagram illustrating a relative positional relationshipbetween the background image and the second image according to theembodiment of the present disclosure;

FIG. 6 is a diagram illustrating a relative positional relationshipbetween the background image and the third image according to theembodiment of the present disclosure;

FIG. 7 is a diagram illustrating a relative positional relationshipbetween the background image and the fourth image according to theembodiment of the present disclosure;

FIG. 8A is a diagram illustrating a bitmap pattern of a first basic maskimage according to the embodiment of the present disclosure;

FIG. 8B is a diagram illustrating a bitmap pattern of a second basicmask image according to the embodiment of the present disclosure;

FIG. 8C is a diagram illustrating a bitmap pattern of a reverse basicmask image according to the embodiment of the present disclosure;

FIG. 8D is a diagram illustrating a bitmap pattern of a third basic maskimage according to the embodiment of the present disclosure;

FIG. 9 is a flowchart illustrating a flow of first image generationprocessing according to the embodiment of the present disclosure;

FIG. 10 is a diagram illustrating a first intermediate image accordingto the embodiment of the present disclosure;

FIG. 11 is a diagram illustrating a first composite image according tothe embodiment of the present disclosure;

FIG. 12 is a flowchart illustrating a flow of second image generationprocessing according to the embodiment of the present disclosure;

FIG. 13 is a diagram illustrating a second composite image according tothe embodiment of the present disclosure;

FIG. 14 is a flowchart illustrating a flow of third image generationprocessing according to the embodiment of the present disclosure;

FIG. 15 is a flowchart illustrating a flow of fourth image generationprocessing according to the embodiment of the present disclosure;

FIG. 16 is a diagram illustrating a composite image generated using thereverse basic mask image in the second through fourth image generationprocessing according to the embodiment of the present disclosure;

FIG. 17 is a flowchart illustrating a flow of fifth image generationprocessing according to the embodiment of the present disclosure; and

FIG. 18 is a diagram illustrating a third composite image according tothe embodiment of the present disclosure.

DESCRIPTION OF EMBODIMENTS

Hereinafter, the image processing device in the embodiment of thepresent disclosure is described below with reference to FIG. 1.

An image processing device 100 as illustrated in FIG. 1 includes a CPU21, a ROM 22, a RAM 23, a HDD 24, and an I/O port 25.

The CPU 21 is a central processing device for controlling the whole ofthe image processing device 100.

The ROM 22 is non-volatile memory that stores programs that are executedby the CPU 21.

The RAM 23 is volatile memory that temporarily holds the programs thatare executed by the CPU 21, and is used as a work area when the CPU 21executes various kinds of processing.

The hard disk drive (HDD) 24 is large-capacity, non-volatile memory forstoring various data such as images.

The I/O port 25 is an interface for connecting and inputter 10 such as akeyboard and/or a mouse (Refer to FIG. 2.) a display 30 such as amonitor display (Refer to FIG. 2.) and/or the image processing device100.

Here the CPU 21 reads the various programs in the ROM 22 and temporarilyplaces the programs in the RAM 23. Then the CPU 21 controls the imageprocessing device 100 in accordance with the various programs, and thusrealizes the function of each component as illustrated in FIG. 2.

The image processing device 100 as illustrated in FIG. 2 functionallyincludes a setter 210, an image generator 220, a storage 240, and anacquirer 250. The inputter 10 and the display 30 are connected to theimage processing device 100.

The inputter 10 is, for example, a keyboard and/or a mouse. The inputter10 receives a user operation and outputs the received information to thesetter 210 or the image generator 220.

The display 30 is a monitor display or the like. The display 30 displaysimages.

The storage 240 is constituted by the HDD 24. The storage 240 storesimages such as images for treatment processing and treated images.Images for treatment processing are optional. In the present disclosure,for ease of understanding, a background image 2410 illustrated in FIG.3A, a first image 2420 illustrated in FIG. 3B, a second image 2430illustrated in FIG. 3C, a third image 2440 illustrated in FIG. 3D, and afourth image 2445 illustrated in FIG. 3E are stored.

The background image 2410 is an image that is placed furthest in thebackground. The first image 2420, the third image 2440, and the fourthimage 2445 are images of bodies of people positioned in front of thebackground image 2410. The second image 2430 is an image of clothingpositioned in front of the first image 2420. Below, the first image issometimes simply referred to as a first person. This same namingconvention is used for the second image through the fourth image.

The relative positions of the background image 2410, the first image2420, the second image 2430, the third image 2440, and the fourth image2445 are predetermined. Also, information regarding the relativepositions is stored in the storage 240.

Specifically, as in an image 2446 of FIG. 4, which indicates therelative position between the background image and the first image, thefirst (first person) image 2420 is placed in a specific relativeposition in front of the background image 2410.

The second image 2430 is an image of clothing of the person in the firstimage 2420. As in an image 2447 of FIG. 5, which indicates the relativeposition between the background image and the second image, the secondimage 2430 (clothing image) is placed in front of the first image 2420.

The third image 2440 is an image of a person who is different from theperson in the first image 2420. As in an image 2448 of FIG. 6, whichindicates the relative position between the background image and thethird image, the third image 2440 is placed in front of and slightly tothe right of the first image 2420.

The fourth image 2445 is an image of a person who is different from theperson in the first image 2420 and the person in the second image 2430.As in an image 2449 of FIG. 7, which indicates the relative positionbetween the background image and the fourth image, the fourth image 2445is placed in front of and slightly to the right of the third image 2440.The first image 2420, the second image 2430, the third image 2440, andthe fourth image 2445 are hereinafter collectively referred to as aforeground image when the individual images need not be distinguishedfrom each other.

Also, the storage 240 stores a first basic mask image 2450, a secondbasic mask image 2460, a reverse basic mask image 2461, and a thirdbasic mask image 2470, as basic mask images for generatingsemi-transparent images.

The first basic mask image 2450, the second basic mask image 2460, thereverse basic mask image 2461, and the third basic mask image 2470stored by the storage 240 are binary images made up of pixels with afirst pixel value indicating opacity and a zero pixel value indicatingtransparence.

In the present embodiment, in semi-transparent processing, the portionbeing not transparent through a pixel of a foreground has the firstpixel value indicating opacity, whereas the portion that allowstransmission through a pixel of a foreground has the zero pixel valueindicating transparence. In other words, this means that the portionwith the first pixel value does not mask the image to be composited (thecolor of the image to be composited is applied on the foreground image),whereas the portion with the zero pixel value masks the image to becomposited (the color of the image to be composited is not applied onthe foreground image). In the former, since the color of the image to becomposited is applied on the foreground image, the color of theforeground image does not show through. In the latter, since the colorof the image to be composited is not applied on the foreground image,the color of the foreground shows through.

In the explanation provided below, for ease of understanding, the firstpixel value is referred to as ‘1’ and the zero pixel value is referredto as ‘0’. Also, the proportion of pixels having a pixel value of ‘1’with respect to all of the pixels of the basic mask image is referred toas the opacity degree of the mask image. Thus, the lower the proportionof pixels having a pixel value of ‘1’ (the greater the proportion ofpixels have a pixel value of ‘0’) is, the more transparent the image tobe composited with the foreground becomes due to masking and due to thecolor not being applied to the foreground image. Therefore, the opacitydegree of the image to be composited decreases (the transparency degreeincreases).

The first basic mask image 2450, the second basic mask image 2460, thereverse basic mask image 2461, and the third basic mask image 2470 eachhave a bitmap pattern respectively illustrated in FIGS. 8A, 8B, 8C, and8D. The bitmap pattern is also commonly referred to as a basic imagepattern.

Basically, the first basic mask image 2450, the second basic mask image2460, the reverse basic mask image 2461, the third basic mask image 2470each have a 8×8 basic pixel pattern respectively illustrated in FIGS.8A, 8B, 8C, and 8D.

The mask image used in the actual semi-transparent processing is made upof multiple vertically-and-horizontally tightly-arranged 8×8 basic pixelpatterns, as illustrated in FIG. 8, so as to be the same size as thebackground image 2410 (so as to have a number of pixels equal to all thepixels of the background image. Since the total number of pixels of thebackground image is substantially greater than the 8×8 basic pixelpattern (for example, several tens of thousands of pixels and so on), itis difficult to visually recognize the basic pixel pattern without useof magnification.

Here, in FIG. 8, a black square indicates a pixel having a pixel valueof ‘1’ (opacity), whereas the white square indicates a pixel having apixel value of ‘0’ (transparence). The portions with a pixel value of‘1’ are drawn due to non-existence of masking (colored portions) whereasthe portions with a pixel value of ‘0’ are not drawn since there is dueto existence of masking (portions without color).

The first basic mask image 2450 is an image having a predeterminedopacity degree. Here, for ease of understanding, the first basic maskimage 2450 has an opacity degree of 10/64 as illustrated in FIG. 8A.Although FIG. 8A is a bitmap pattern, since the first basic mask image2450 is a repeating pattern of this bitmap pattern, the opacity degreeis 10/64.

Also, the reverse basic mask image 2461 is an image in which the pixelvalues ‘1’ and ‘0’ of the first basic mask image 2450 are reversed, asillustrated in FIG. 8C. Therefore, if the opacity degree of the firstbasic mask image 2450 is A (%), then the opacity degree of the reversebasic mask image 2461 is 100−A (%) opacity degree.

In the second basic mask image 2460, as illustrated in FIG. 8B, thepixels with a pixel value of ‘0’ are in the same position as the pixelswith a pixel value of ‘1’ of the first basic mask image 2450. A portionof the pixels in the image that are in the same positions as the pixelswith a pixel value of ‘0’ in the first basic mask image 2450 have apixel value of ‘0’ but besides this exception, the rest of the pixelshave a value of ‘1’. In other words, the second basic mask image 2460 isan image in which the portions of the first basic mask image 2450 with apixel value of ‘1’ are reversed to ‘0’.

The pixels of both the first basic mask image 2450 and the second basicmask image 2460 that both have a pixel value of ‘1’ have a pixel valueof ‘0’ in the third basic mask image 2470. Also, the pixels of the firstbasic mask image 2450 and the second basic mask image 2460 that bothhave a pixel value of ‘0’ instead have a pixel value of ‘1’ in the thirdbasic mask image 2470. In other words, the third basic mask image 2470is an image in which NOR operation of the first basic mask image 2450and the second basic mask image 2460 has been performed.

The first basic mask image 2450, the second basic mask image 2460, thethird basic mask image 2470, and the reverse basic mask image 2461 arehereinafter collectively referred to as a basic mask image when theindividual images need not be distinguished from each other.

Referring back to FIG. 2, the acquirer 250 acquires an image from thestorage 240 and outputs the acquired image to the image generator 220.

The acquirer 250 also acquires an image generated by the image generator220 and stores the acquired image in the storage 240.

The setter 210 performs settings based on the user operations receivedby the inputter 10. Specifically, the setter 210 sets a relativeposition between one of the images stored by the storage 240 and theother image based on the user operation received by the inputter 10. Therelative positions between the background image 2410 and first image2410, the second image 2420, the third image 2440, and the fourth image2445 are predetermined and such information is stored in the storage240, but this is not limiting. For example, if the acquirer 250 acquiresthe above-described image from the storage 240 and provides the acquiredimage to the image generator 220, the setter 210 may set theabove-described relative positions based on the user operations receivedby the inputter 10.

Also, the setter 210 sets a new basic mask image and stores the setbasic mask image in the storage 240 based on the user operationsreceived by the inputter 10.

The image generator 220 generates an image based an image to be treatedand the basic mask image acquired by the acquirer 250 from the storage240. The image generator 220 displays the generated image on the display30. The image generator 220 also stores the generated image in thestorage 240 via the acquirer 250.

The image generator 220 performs various types of treatment processingon the images to be treated and then generates a new image.

In the present embodiment, the image generator 220 in particulargenerates an image in which one image is composited with the otherimage. Specifically, the image generator 220 generates, as a compositedimage, an image that has pixel values calculated based on the pixelvalues of pixels of one image and the pixel values of pixels of theother image that is in the same position as the one image.

The image generator 220 also generates an image in which the one imageis overwritten onto the other image. Specifically, the image generator220 replaces the pixel value of pixels of the other image that is in thesame position as the one image with the pixel value of pixels of the oneimage and generates an overwritten image.

Furthermore, the image generator 220 performs semi-transparentprocessing using a basic mage image on a foreground image (the firstimage through the fourth image) to composite the background image 2410.

Image processing is described in detail below.

The first through fifth image generation processing performed by theimage generator 220 is described sequentially below.

(First Image Generation Processing)

First image generation processing performed by the image processingdevice 100 is described below with reference to FIG. 9.

The first image generation processing is processing in which the samebasic mask image is used for compositing two foreground images onto thebackground image. The first image generation processing begins when theuser instructs execution of the first image generation processing.

The user selects an image to be used for generating an image (forexample, the background image 2410 and a foreground image to becomposited onto the background image 2410) via the inputter 10, and theninstructs execution of the first image generation processing.

Image selection is performed, for example, via the image selectionscreen displayed on the display 30. Hereinafter, for ease ofunderstanding, the descriptions below presupposes that the user selectedthe background image 2410 illustrated in FIG. 3A as the background imageand specified the first image illustrated in FIG. 3B and the secondimage illustrated in FIG. 3C as the foreground images.

In step S101, in response to the instruction to execute the first imagegeneration processing, the acquirer 250 acquires the background image2410 and the first image 2420 specified by the user from the storage240. In response to the instruction to execute the first imagegeneration processing, the acquirer 250 also acquires one basic maskimage among a plurality of images stored in the storage 240. In thisexample, the first basic mask image 2450 illustrated in FIG. 8A isacquired.

In step S102, the image generator 220 masks the first image 2420 withthe first basic mask image 2450 and then overwrites the background image2410. In doing so, a first intermediate image 2480 illustrated in FIG.10 is generated.

More specifically, the image generator 220:

(1) generates the first basic mask image 2450 by repeatedly arrangingthe bitmap pattern of the first basic mask image;

(2) adjusts the position of the first basic mask image 2450 generatedwith the background image 2410 and the first image 2420; and

(3) performs processing to overwrite the pixel values of the pixels inthe first image 2420 onto the pixels corresponding to background image2410, in the pixels that are in the same position as the pixels in thefirst basic mask image 2450 having a pixel value of ‘1’. Through thisprocessing, the color of the first image 2420 is applied to the pixelscorresponding to the pixel value ‘1’ of the background image 2410. Atsuch time, overwriting onto the background image 2410 is not performedfor the pixels of the first image 2420 that are in the same position asthe pixels in the first basic mask image 2450 having a pixel value of‘0’. Through this processing, the color of the first image 2420 is notapplied to the pixels corresponding to the pixel value ‘0’ of thebackground image 2410.

Through this processing, the first intermediate image 2480 illustratedin FIG. 10 is generated. The intermediate image 2480 is an image that ispositioned where the semi-transparent first image 2420 is positioned infront of the background image 2410.

Next, in step S103, the acquirer 250 acquires the second image 2430 fromthe storage 240.

In step S104, the image generator 220 masks the second image 2430 withthe first basic mask image 2450 and then overwrites the firstintermediate image 2480. By doing so, the image 2490 illustrated in FIG.11 is generated as a first composite image and then the generated image2490 is displayed on the display 30. The masking and overwritingprocessing is the same as that of the processing in (1) to (3) of stepS102.

After completion of step S104, the image generator 220 ends the firstimage generation processing.

By focusing on the final appearance, it can be said that the firstcomposite image 2490 of FIG. 11 which was generated via the first imagegeneration processing, is an image satisfying (i) and (ii) describedbelow.

The first composite image 2490 is an image in which (i) the second image2430 is composited onto the background image 2410 in the pixels that arein the same positions as the pixels in the first basic mask image 2450having a pixel value of ‘1’. The first composite image 2490 is also animage in which (ii) the first image 2420 is composited at the pixelsthat are in the same positions as the pixels in the first basic maskimage 2450 having a value of ‘1’ where the second image 2430 is notcomposited. Provided that the first composite image 2490, whichsatisfies both (i) and (ii), is attained, relying on the first imagegeneration processing in FIG. 9 is not essential. In other words, thefirst composite image 2490, which satisfies the above-described (i) and(ii), may be generated by another kind of generation processing.

In the first image generation processing, when there are two foregroundimages (body and clothing) with respect to the background image 2410,masking is performed 2 using the same basic mask image (the first basicmask image 2450 in the first image generation processing, for example).Based on this technical idea, since clothing is overwritten onto body inthe areas where the clothing overlaps with the body, the body does notshow through. Also, the body and the clothing may be set assemi-transparent by changing the opacity degree of the basic mask image.This enables simple and quick generation of a composite image in whichthe first image 2420 and the second image 2430 appear semi-transparentwith respect to the background image 2410 and the first image 2420 (bodyof a person) does not show through.

As depicted in FIG. 11, the first image 2420 is an image of a body of aperson, the second image 2430 is an image of clothing of the person, andthe body cannot be seen through the clothing in the image 2490.

In step S102, the image generator 220 may mask and composite the firstimage 2420 with the first basic mask image 2450. Specifically,processing in which “compositing in pixels” is performed instead of“overwriting on the pixels” may be performed in the above-described (3)of step S102. Even for images generated in this manner, the first image2420 in the same position as the second image 2430 is not visible.

(Second Image Generation Processing)

Next, second image generation processing performed by the imageprocessing device 100 is described with reference to FIG. 12.

This second image generation processing is different in that in additionthe first image generation processing, a third image is used as aforeground image and the second basic mask image is used as a basic maskimage. The start timing of the second image generation processing is thesame as that of the first image generation processing.

In step S201, the image generator 220 generates the image 2490 as thefirst composite image by performing processing the same as the firstimage generation processing.

In step S202, the acquirer 250 acquires the third image 2440 and thesecond basic mask image 2460 from the storage 240.

In step S203, the image generator 220 masks and overwrites the thirdimage 2440 onto the first composite image 2490 with the second basicmask image 2460. By doing so, an image 2491 illustrated in FIG. 13 isgenerated as the second composite image and then the generated image2491 is displayed on the display 30. The masking and overwritingprocessing is the same as that of the processing in (1) to (3) of stepS102.

After completion of step S204, the image generator 220 ends the secondimage generation processing.

(Third Image Generation Processing)

Next, third image generation processing performed by the image generator220 is described with reference to FIG. 14. The sequence for generatingthe image 2491 illustrated in FIG. 13 in the third image generationprocessing is different from that of the second image generationprocessing. The start timing of the third image generation processing isthe same as that of the first image generation processing.

In step S301, in response to the instruction to execute the third imagegeneration processing, the acquirer 250 acquires the background image2410 and the third image 2440 specified by the user from the storage240.

In response to the instruction to execute the third image generationprocessing, the acquirer 250 also acquires one basic mask image amongthe plurality of images stored in the storage 240. In this example, thesecond basic mask image 2460 illustrated in FIG. 8B is acquired.

In step S302, the image generator 220 overwrites the third image 2440onto the background image 2410 by masking with the second basic maskimage 2460. In doing so, a second intermediate image (not illustrated)is generated. The masking and overwriting processing is the same as thatof the processing in (1) to (3) of step S102.

In step S303, the acquirer 250 acquires the first image 2420 and thefirst basic mask image 2450 from the storage 240.

In step S304, the image generator 220 overwrites first image 2420 ontothe second intermediate image generated in step S302 by masking with thefirst basic mask image 2450. In doing so, a third intermediate image(not illustrated) is generated. The masking and overwriting processingis the same as that of the processing in (1) to (3) of step S102.

In step S305, the acquirer 250 acquires the second image 2430 from thestorage 240.

In step S306, the image generator 220 overwrites the second image 2430onto the third intermediate image generated in step S304 by masking withthe first basic mask image 2450. By doing so, the image 2491 illustratedin FIG. 13 is generated as the second composite image and then thegenerated image 2491 is displayed on the display 30. The masking andoverwriting processing is the same as that of the processing in (1) to(3) of step S102.

After completion of step S306, the image generator 220 ends the thirdimage generation processing.

(Fourth Image Generation Processing)

Next, fourth image generation processing performed by the imagegenerator 220 is described with reference to FIG. 15. The sequence forgenerating the image 2491 illustrated in FIG. 13 in the fourth imagegeneration processing is different from that of the second imagegeneration processing and the third image generation processing. Thestart timing of the fourth image generation processing is the same asthat of the first image generation processing.

The processing in steps S401 and S402 is the same as the processing insteps S101 and S102 of the first image generation processing illustratedin FIG. 9, respectively.

In step S403, the acquirer 250 acquires the third image 2440 and thesecond basic mask image 2460 from the storage 240.

In step S404, the image generator 220 overwrites the third image 2440onto the first intermediate image 2480 generated in step S402 by maskingwith the second basic mask image 2460. In doing so, a fourthintermediate image (not illustrated) is generated. The masking andoverwriting processing is the same as that of the processing in (1) to(3) of step S102.

In step S405, the acquirer 250 acquires the second image 2430 from thestorage 240.

In step S406, the image generator 220 overwrites the second image 2430onto the fourth intermediate image generated in the steps S404 bymasking with the first basic mask image 2450. By doing so, the image2491 illustrated in FIG. 13 is generated as the second composite imageand then the generated image 2491 is displayed on the display 30. Themasking and overwriting processing is the same as that of the processingin (1) to (3) of step S102.

After completion of step S406, the image generator 220 ends the fourthimage generation processing.

The image 2491 in FIG. 13 generated by the second image generationprocessing through the fourth image generation processing is an image inwhich the third image 2440 is composited only in the pixels that are inthe same positions as the pixels in the second basic mask image 2460having the pixel value of ‘1’. Also, the pixels that are in the samepositions as the pixels in the second basic mask image 2460 having thepixel value of ‘1’, in the first basic mask image 2450 instead have thepixel value of ‘0’. Therefore, in the image 2491, the third image 2440overlaps with the first image 2420 and the second image 2430 without anychange of color, for example.

In other words, even when crossfading the foreground images of twopeople, the portions of the basic mask images (the first basic maskimage 2450 and the second basic mask image 2460, for example, in thepresent embodiment) having the pixel value of ‘1’ that mask each of theforeground images do not overlap. Therefore the foreground image of thetwo people may be set as semi-transparent by changing the opacity degreewithout experiencing any discoloration and so on.

As depicted in FIG. 13, the first image 2420 is an image of a body ofthe first person. The second image 2430 is an image of clothing of thefirst person. The third image 2440 is an image of a second person. Also,the second person crossfades with the first person.

In step S201, step S304, and step S402, the image generator 220 maycomposite the first image 2420 by masking with the first basic maskimage 2450. Also, in step S203, step S302, and step S404, the imagegenerator 220 may composite the third image 2440 by masking with thesecond basic mask image 2460. Specifically, processing in which“compositing in pixels” is performed instead of “overwriting on thepixels” may be performed in the above-described (3) of step S102. Evenfor images generated in this manner, the first image 2420 in the sameposition as the second image 2430 is not visible.

Also, as for the second basic mask image 2460 utilized in the secondimage generation processing through the fourth image generationprocessing, the pixels that are in the same positions as the pixels ofthe first basic mask image 2450 having the pixel value of ‘0’ do notnecessarily have a pixel value of ‘1’. In other words, there is an areaother than the two cross-shaped areas (areas with a pixel value of ‘0’)in FIG. 8B that has a pixel value of ‘0’. Due to this, at the portionsof the first image 2420, the second image 2430, and the third image 2440where there is overlapping, the outer edges of the mountains in thebackground image 2410, as illustrated in FIG. 13, show through.

Also, in the second image generation processing through the fourth imagegeneration processing, the reverse basic mask image 2461 may be usedinstead of the second basic mask image 2460. Specifically, the acquirer250 acquires the reverse basic mask image 2461 instead of the secondbasic mask image 2460. Then, the image generator 220 masks the thirdimage 2440 with the reverse basic mask image 2461 and then compositesthe masked third image 2440 with the image 2490. Also, the image 2492illustrated in FIG. 16 may be generated as the second composite image.

Unlike the second basic mask image 2460, the pixels of the reverse basicmask image 2461 that are in the same positions as the pixels of thefirst basic mask image 2450 having the pixel value of ‘0’ have a pixelvalue of ‘1’. In other words, the reverse basic mask image 2461 is amask image in which the ‘1’ and ‘0’ of the first basic mask image 2450are reversed. Due to this, at the portions of the first image 2420, thesecond image 2430, and the third image 2440 where there is overlapping,the outer edges of the mountains in the background image 2410, asillustrated in FIG. 16, do not show through.

As such, as soon as one person (the person composed of the first image2420 and the second image 2430 in FIG. 16) fades out and the otherperson (the person composed of the third image 2440 in the exampledepicted in FIG. 16) fades in, the outer edges of the mountains in thebackground image 2410 cannot be seen. Therefore, there is no sense ofunnaturalness from the viewpoint of the user.

Also, the use of the reverse basic mask image 2461 avoids overlapping ofthe first image 2420 and the second image 2430 (body and clothing) withthe third image 2440 (body). The usage also enables for the generationof simple and high-speed crossfaded composite images having an invertedopacity degree of the opacity degree of the first basic mask image 2450(for example, a 40% opacity degree when the first basic mask image 2450has an opacity degree of 60%).

Also, in the second image generation processing through the fourth imagegeneration processing, any basic mask image set as desired based on theuser operation may be used instead of the second basic mask image 2460.Also, pixels of the set basic mask image that are in the same positionsas the pixels in the first basic mask image 2450 having a pixel value of‘1’ do not necessarily have a pixel value of ‘0’. In other words, theportions of the set basic mask image and the first basic mask image 2450that have a pixel value of ‘1’ may overlap. As for the pixels having apixel value of ‘1’ in the overlapping portions of the two basic maskimage, one of the foreground images (the first image 2420, for example)is overlapped by another foreground image (the third image 2440, forexample). However, the user may set the basic mask images that the userdesires to see so that the overlapping does not appear unnatural.

Specifically, instead of acquiring the second basic mask image 2460, theacquirer 250 acquires the basic mask image set based on the useroperation as the second basic mask image. The acquirer 250 also outputsthe acquired second basic mask image to the image generator 220. Theimage generator 220 may also generate an image in which the third image2440 is masked by the acquired second basic mask image and thencomposited to the image 2490. In doing so, while confirming the image inwhich the third image 2440 is masked by the second basic mask image andcomposited to the image 2490, the user may set the second basic maskimage so that an image desired by the user is generated.

Also, for the second image generation processing through the fourthimage generation processing, the sequence of the processing is differentwhen the image 2491 illustrated in FIG. 13 is generated. In the presentembodiment the pixels in the second basic mask image that are in thesame positions as the pixels in the first basic mask image having pixelvalue of ‘1’ have a pixel value of ‘0’. Therefore, the pixels of thefirst image and the third image which are foreground images used in thesecond image generation processing through the fourth image generationprocessing do not overlap when they are composited. Therefore, the image2491 illustrated in FIG. 13 may be generated the same way regardless ofthe sequence of the processing.

In the second image generation processing through the fourth imagegeneration processing, although the premise is that third image and thesecond basic mask image are one image this is not limiting. For example,the storage 240 may pre-store a number of different third images and anumber of different second basic mask images. In such a case, in thesecond image generation processing through the fourth image generationprocessing, for example, the acquirer 250 may acquire the desired thirdimage and the desired second basic mask image one at a time from thestorage 240. Then, the image generator 220 may utilize these to performcomposition processing.

Alternatively, the acquirer 250 acquires two or more of the desiredthird images and the desired second basic mask images from the storage240. Then the image generator 220 may utilize these to performcomposition two or more times. In such a case, as long as the portionsof the two or more basic mask images having a pixel value of ‘1’,acquired by the acquirer 250, do not overlap with each other, there isno change of color in the third images to be composited, for example,where there is overlapping, even when composition processing isperformed two or more times. This enables a plurality of differentpeople to be faded in.

(Fifth Image Generation Processing)

Next, fifth image generation processing is described with reference toFIG. 17. The fifth image generation processing is different in that inaddition to the first image generation processing through the fourthimage generation processing, the fourth image 2445 is used as aforeground image and the third basic mask image 2470 is used as a basicmask image. The start timing of the fifth image generation processing isthe same as that of the first image generation processing.

In step S501, the image generator 220 performs processing the same asthe second image generation processing. By doing so, the image 2491 isgenerated as the second composite image.

In step S502, the acquirer 250 acquires the fourth image 2445 and thethird basic mask image 2460 from the storage 240.

In step S503, the image generator 220 masks the fourth image 2445 withthe third basic mask image 2460 and then overwrites the second compositeimage 2491. By doing so, the image 2493 illustrated in FIG. 18 isgenerated as a third composite image and then the generated image 2493is displayed on the display 30. The masking and overwriting processingis the same as that of the processing in (1) to (3) of step S102.

After completion of step S503, the image generator 220 ends the fifthimage generation processing.

The image 2493 generated in the fifth image generation processing is animage in which the fourth image 2445 is composited only in the pixelsthat are in the same positions as the pixels in the third basic maskimage 2470 having the pixel value of ‘1’.

Therefore, in the image 2493, the fourth image 2445 is only compositedin pixels of the third basic mask image 2470 having the pixel value of‘1’. Therefore, the fourth image 2445 appears semi-transparent withrespect to the background image 2410 in accordance with the opacitydegree third basic mask image 2470. Also, the pixels in the third basicmask image 2470 that are in the same positions as the pixels in thefirst and the second basic mask image 2450 having a pixel value of ‘1’have a pixel value of ‘0’. Therefore, in the image 2493, the fourthimage 2445 that overlaps with the first image 2420, the second image2430, and third image 2440 without any change of color, for example.

Furthermore, the pixels in the third basic mask image 2470 that are inthe same positions as the pixels in the first basic mask image 2450having the pixel value of ‘0’ and that are in the same positions as thepixels in the second basic mask image 2460 having the pixel value of ‘0’have a pixel value of ‘1’. Due to this, at the portions of the firstimage 2420, the second image 2430, the third image 2440, and the fourthimage 2445 where there is overlapping, the outer edges of the mountainsin the background image 2410, as illustrated in FIG. 18, do not shownthrough.

As illustrated in FIG. 18, the first image 2420 is an image of a body ofa first person. The second image 2430 is an image of clothing of thefirst person. The third image 2440 is an image of a second person. Thefourth image 2445 is an image of a third person. In the image 2493, thefirst person, the second person, and the third person are crossfade witheach other.

In step S501, the image generator 220 may perform compositing by maskingthe first image 2420 with the first basic mask image 2450. The imagegenerator 220 may also perform compositing by masking the third image2440 with the second basic mask image 2460. The image generator 220 mayalso perform compositing in step S503 by masking the fourth image 2445with the third basic mask image 2470. Specifically, processing in which“compositing in pixels” is performed instead of “overwriting on thepixels” may be performed in the above-described (3) of step S102. Evenfor images generated in this manner, the first image 2420 in the sameposition as the second image 2430 is not visible.

In the second image generation processing through the fifth imagegeneration processing, the third image 2440 of a body of a person andthe fourth image 2445 of a body of a person are described as not havingclothing, but this is not limiting. For example, an image of clothingmay overlap with the third image 2440 and another image of clothing mayoverlap with the fourth image 2445.

In such a case, a method similar to using the first basic mask image2450 two times in the first image generation processing can be used. Inother words, the third image 2440 and the clothing that overlaps withthe third image 2440 are masked two times with the second basic maskimage 2460. Furthermore, the fourth image and the clothing that overlapswith the fourth image 2445 are also masked two times with the thirdbasic mask image 2470.

That is to say, by masking with the same basic mask image multipletimes, the more deeply-positioned image is overwritten by the image inthe most front position even when there are multiple images. Therefore,more-deeply positioned images can be made to not show through, multipleimages can be made semi-transparent by the opacity degree of the basicmask images, and the multiple images can be composited onto thebackground image.

Also, in the first image generation processing through the fifth imagegeneration processing, although the image generator 220 masks andoverwrites the entire area of the foreground with the basic mask imagethis is not limiting. For example, the masking and overwriting with thebasic mask image may be performed on only a portion of the foregroundimage. Thus, for example, a portion of the clothing of the second image2430 may be masked by the first basic mask image 2450 and then the body,which is the first image 2420, may be overwritten. Then, processingother than overwriting (transparent compositing, for example) may becarried out for portions other than that one portion of the clothing.

Also, each basic mask image used in the first image generationprocessing through the fifth image generation processing (the firstbasic mask image 2450, the second basic mask image 2460, and the thirdbasic mask image 2470) are generated by arranging each of thecorresponding bitmap patterns illustrated in FIG. 8A, FIG. 8B, FIG. 8C,and FIG. 8D. In other words, as long as there is a function to achievethese basic mask images, the basic mask images do not actually need tobe generated. For example, the information equivalent to the basic maskimages may be dynamically generated by an equation or a specialalgorithm without generating a basic mask image and then theabove-described first image generation processing through the fifthimage generation processing may be performed.

Also, the present embodiment describes that the pixel value of ‘1’indicates opacity and the pixel value of ‘0’ indicates transparence inthe mask image, but this is not limiting. In other words, any imagevalue may be used in the mask image as long as the first pixel valueindicating opacity (the portion in which the foreground image is notsee-through) and the zero pixel value indicating transparence (theportion in which the foreground is see-through) are distinguishable. Forexample, the pixel value of ‘1’ may indicate transparence and the pixelvalue of ‘0’ may indicate opacity and any other pixel values may beused.

Also, the above-described embodiment describes that the program forrealizing each operation (the setter 210, the image generator 220, theacquirer 250, and the like) for each processing is pre-stored in the ROM22. However, the program for realizing the functions of each unit may bestored and distributed on a non-transitory computer-readable recordingmedium such as a flexible disc, compact disc read-only memory (CD-ROM),digital versatile disc (DVD), magneto optical (MO) disc and/or the like.In addition, by installing the program on a computer such as a PC, adevice that executes the above-described functions of each unit may berealized.

Furthermore, the program may be stored on a disk device and/or the likeof a server device on the Internet. Also, the program may also, forexample, be downloaded to a computer and/or the like.

The foregoing describes an embodiment and modified example forexplanatory purposes. Although the foregoing discussion has presented aspecific embodiment and modified example, persons skilled in the artwill recognize that changes may be made in form and detail withoutdeparting from the broader spirit and scope of the invention.Accordingly, the specification and drawings are to be regarded in anillustrative rather than a restrictive sense. This detailed description,therefore, is not to be taken in a limiting sense, and the scope of theinvention is defined only by the included claims, along with the fullrange of equivalents to which such claims are entitled.

(Supplemental Note 1)

An image processing device, including:

storage means for storing a background image, a first image and a secondimage that are foreground images with respect to the background imageand have predetermined positions relative to the background image, and afirst mask image formed from pixels having a first pixel valueindicating opacity and pixels having a zero pixel value indicatingtransparence;

acquisition means for acquiring the background image, the first image,the second image, and the first mask image from the storage means; and

image generation means for generating a first composite image in whichthe second image acquired by the acquisition means is composited, ontothe background image acquired by the acquisition means, in the pixelsthat are in the same positions as the pixels in the first mask imagehaving the first pixel value, and the first image acquired by theacquisition means is composited, onto the background image acquired bythe acquisition means, where the second image is not composited, in thepixels that are in the same positions as the pixels in the first maskimage having the first pixel value.

(Supplemental Note 2)

The image processing device according to claim 1, wherein

the image generation means generates a first intermediate image in whichthe first image is composited onto the background image, only in pixelsthat are in the same positions as the pixels in the first mask imagehaving the first pixel value, and then generates the first compositeimage by overwriting the second image onto the first intermediate image,only in pixels that are in the same positions as the pixels in the firstmask image having the first pixel value.

(Supplemental Note 3)

The image processing device according to claim 1 or 2, wherein

the storage means stores a third image that is a foreground image withrespect to the background image and has a predetermined positionrelative to the background image, and stores a second mask image formedfrom pixels having the first pixel value indicating opacity and pixelshaving the zero pixel value indicating transparence, wherein the pixelsthat are in the same positions as the pixels in the first mask imagehaving the first pixel value have the zero pixel value,

the acquisition means acquires the third image and the second mask imagefrom the storage means, and

the image generation means generates a second composite image bycompositing the third image onto the first composite image in pixelsthat are in the same positions as the pixels in the second mask imagehaving the first pixel value.

(Supplemental Note 4)

The image processing device according to claim 3, wherein

the pixels in the second mask image that are in the same position as thepixels in the first mask image having the zero pixel value have a firstpixel value.

(Supplemental Note 5)

The image processing device according to claim 3, wherein

the storage means stores a fourth image with respect to the backgroundimage and has a predetermined position relative to the background image,and stores a third mask image formed from pixels having the first pixelvalue indicating opacity and pixels having the zero pixel valueindicating transparence, wherein the pixels that are also in the samepositions as the pixels in the second mask image having the first pixelvalue have the zero pixel value,

the acquisition means acquires the fourth image and the third mask imagefrom the storage means, and

the image generation means generates a third composite image bycompositing the fourth image onto the second composite image in pixelsthat are in the same positions as the pixels in the third mask imagehaving the first pixel value.

(Supplemental Note 6)

The image processing device according to claim 5, wherein

the pixels in the third mask image that are in the same positions as thepixels in the first mask image having the zero pixel value and that arein the same positions as the pixels in the second mask image having thezero pixel value have the first pixel value.

(Supplemental Note 7)

The image processing device according to claim 1 or 2, furtherincluding:

setting means for setting, in the storage means, a second mask imageformed from pixels having the first pixel value indicating opacity andpixels having the zero pixel value indicating transparence, based on auser operation,

wherein

-   -   the storage means stores a third image that has a predetermined        positions relative to the background image, and the second mask        image set by the setting means,    -   the acquisition means acquires the third image and the second        mask image from the storage means, and    -   the image generation means generates a second composite image by        compositing the third image onto the first composite image in        pixels that are in the same positions as the pixels in the        second mask image having the first pixel value.

(Supplemental Note 8)

The image processing device according to any one of claims 1 to 7,wherein

the first pixel value is ‘1’ and the zero pixel value is ‘0’.

(Supplemental Note 9)

An image processing method, comprising:

storing a background image, a first image and a second image that areforeground images with respect to the background image and havepredetermined positions relative to the background image, and a firstmask image formed from pixels having a first pixel value indicatingopacity and pixels having a zero pixel value indicating transparence;

acquiring the background image, the first image, the second image, andthe first mask image that are stored; and

generating a first composite image in which the second image iscomposited, onto the background image acquired, in the pixels that arein the same positions as the pixels in the first mask image having thefirst pixel value, and the first image is composited, onto thebackground image acquired, where the second image is not composited, inthe pixels that are in the same positions as the pixels in the firstmask image having the first pixel value.

(Supplemental Note 10)

A program configured to cause a computer to function as:

storage means for storing a background image, a first image and a secondimage that are foreground images with respect to the background imageand have predetermined positions relative to the background image, and afirst mask image formed from pixels having a first pixel valueindicating opacity and pixels having a zero pixel value indicatingtransparence;

acquisition means for acquiring the background image, the first image,the second image, and the first mask image from the storage means; and

image generation means for generating a first composite image in whichthe second image acquired by the acquisition means is composited, ontothe background image acquired by the acquisition means, in the pixelsthat are in the same positions as the pixels in the first mask imagehaving the first pixel value, and the first image acquired by theacquisition means is composited, onto the background image acquired bythe acquisition means, where the second image is not composited, in thepixels that are in the same positions as the pixels in the first maskimage having the first pixel value.

This application claims the benefit of Japanese Patent Application No.2014-055087, filed on Mar. 18, 2014, including the specification,claims, drawings, and abstract, the entire disclosure of which isincorporated herein by reference.

REFERENCE SIGNS LIST

-   -   10 Inputter    -   21 CPU    -   22 ROM    -   23 RAM    -   24 HDD    -   25 I/O port    -   30 Display    -   100 Image processing device    -   210 Setter    -   220 Image generator    -   240 Storage    -   250 Acquirer    -   2410 Background image    -   2420 First image    -   2430 Second image    -   2440 Third image    -   2445 Fourth image    -   2446 Image indicating the relative position between the        background image and the first image    -   2447 Image indicating the relative position between the        background image and the second image    -   2448 Image indicating the relative position between the        background image and the third image    -   2449 Image indicating the relative position between the        background image and the fourth image    -   2450 First basic mask image    -   2460 Second basic mask image    -   2461 Reverse basic mask image    -   2470 Third basic mask image    -   2480 First intermediate image    -   2490 First composite image    -   2491 Second composite image    -   2492 Composite image generated using the reverse basic mask        image    -   2493 Third composite image

The invention claimed is:
 1. An image compositing device based on a maskimage, comprising: a processor; and a memory storing a non-transitorycomputer executable program for directing the processor to achieve thefollowing operations: storing a background image, a first image and asecond image that are foreground images with respect to the backgroundimage and have predetermined positions relative to the background image,and a first mask image for generating a semi-transparent image, whereinthe first mask image is formed from pixels having a first pixel valueindicating opacity and pixels having a zero-th pixel value indicatingtransparence; acquiring the stored background image, the stored firstimage, the stored second image, and the stored first mask image; andgenerating a first composite image by generating a first intermediateimage in which the acquired first image is composited onto the acquiredbackground image, only in pixels that are in the same positions as thepixels in the acquired first mask image having the first pixel value,and then overwriting the acquired second image onto the firstintermediate image, only in pixels that are in the same positions as thepixels in the acquired first mask image having the first pixel value. 2.The image processing device according to claim 1, wherein the storingstep further comprises storing a third image that is a foreground imagewith respect to the background image and has a predetermined positionrelative to the background image, and storing a second mask image formedfrom pixels having the first pixel value indicating opacity and pixelshaving the zero-th pixel value indicating transparence, wherein thepixels that are in the same positions as the pixels in the first maskimage having the first pixel value have the zero-th pixel value, theacquiring step further comprises acquiring the stored third image andthe stored second mask image, and the image generating step furthercomprises generating a second composite image by compositing the thirdimage onto the first composite image in pixels that are in the samepositions as the pixels in the second mask image having the first pixelvalue.
 3. The image processing device according to claim 2, wherein thepixels in the second mask image that are in the same position as thepixels in the first mask image having the zero-th pixel value have thefirst pixel value.
 4. The image processing device according to claim 2,wherein the storing step further comprises storing a fourth image withrespect to the background image and has a predetermined positionrelative to the background image, and storing a third mask image formedfrom pixels having the first pixel value indicating opacity and pixelshaving the zero-th pixel value indicating transparence, wherein thepixels that are also in the same positions as the pixels in the secondmask image having the first pixel value have the zero-th pixel value,the acquiring step further comprises acquiring the stored fourth imageand the stored third mask image, and the image generating step furthercomprises generating a third composite image by compositing the fourthimage onto the second composite image in pixels that are in the samepositions as the pixels in the third mask image having the first pixelvalue.
 5. The image processing device according to claim 4, wherein thepixels in the third mask image that are in the same positions as thepixels in the first mask image having the zero-th pixel value and thatare in the same positions as the pixels in the second mask image havingthe zero-th pixel value have the first pixel value.
 6. The imageprocessing device according to claim 1 wherein the processor is directedby the non-transitory computer executable program stored in the memoryto set a second mask image formed from pixels having the first pixelvalue indicating opacity and pixels having the zero-th pixel valueindicating transparence, based on a user operation, to store a thirdimage that has predetermined positions relative to the background image,and the set second mask image, to acquire the stored third image and thestored second mask image, and to generate a second composite image bycompositing the third image onto the first composite image in pixelsthat are in the same positions as the pixels in the second mask imagehaving the first pixel value.
 7. The image processing device accordingto claim 1, wherein the first pixel value is ‘1’ and the zero-th pixelvalue is ‘0’.
 8. An image compositing method based on a mask image andimplemented by a processor, comprising: storing a background image, afirst image and a second image that are foreground images with respectto the background image and have predetermined positions relative to thebackground image, and a first mask image for generating asemi-transparent image, wherein the first mask image is formed frompixels having a first pixel value indicating opacity and pixels having azero-th pixel value indicating transparence; acquiring the storedbackground image, the stored first image, the stored second image, andthe stored first mask image; and generating a first composite image bygenerating a first intermediate image in which the acquired first imageis composited onto the acquired background image, only in pixels thatare in the same positions as the pixels in the acquired first mask imagehaving the first pixel value, and then overwriting the acquired secondimage onto the first intermediate image, only in pixels that are in thesame positions as the pixels in the acquired first mask image having thefirst pixel value.
 9. A non-transitory computer-readable recordingmedium storing a program configured to: store a background image, afirst image and a second image that are foreground images with respectto the background image and have predetermined positions relative to thebackground image, and a first mask image for generating asemi-transparent image, wherein the first mask image is formed frompixels having a first pixel value indicating opacity and pixels having azero-th pixel value indicating transparence; acquire the storedbackground image, the stored first image, the stored second image, andthe stored first mask image; and generate a first composite image bygenerating a first intermediate image in which the acquired first imageis composited onto the acquired background image, only in pixels thatare in the same positions as the pixels in the acquired first mask imagehaving the first pixel value, and then overwriting the acquired secondimage onto the first intermediate image, only in pixels that are in thesame positions as the pixels in the acquired first mask image having thefirst pixel value.
 10. The image compositing device based on a maskimage according to claim 1, wherein the first mask image includestightly-arranged basic pixel patterns.